using System.Collections;
using System.Collections.Generic;
using Base;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;

public class CharactersItem : MonoBehaviour
{ 
    [SerializeField] public Text nameLabel;
    [SerializeField] public Image charactersIcon;
    [SerializeField] public Text hpLabel;
    [SerializeField] public Text speedLabel;
    [SerializeField] public Image selectBG;
    [SerializeField] public Text selectLabel;
    [SerializeField] public Button selectBtn;
    
    public int id;
    void Start()
    {
        selectBtn.onClick.AddListener(OnSelect);
    }

    private void OnSelect()
    {
        if (GameManager.Instance.playerData.playerID != id)
        {
            GameManager.Instance.playerData.playerID = id;
            GameManager.Instance.OnPlayerDataSave();
            EventCenterManager.Instance.Dispatch(EventCommand.CharacterSelect);
            
        }
    }

    
}
